package poki.model;

import poki.model.etc.ComparableCard;

@SuppressWarnings("javadoc")
public class Card implements ComparableCard {

	// Static color
	public static final int CLUB    = 1; // Kreuz
	public static final int SPADE   = 2; // Pik
	public static final int HEART   = 3; // Herz
	public static final int DIAMOND = 4; // Karo
	public static final String[] colorNames = new String[] { "Kreuz", "Pik", "Herz", "Karo" };

	// Static cards
	public static final int N2 = 2;
	public static final int N3 = 3;
	public static final int N4 = 4;
	public static final int N5 = 5;
	public static final int N6 = 6;
	public static final int N7 = 7;
	public static final int N8 = 8;
	public static final int N9 = 9;
	public static final int NT = 10;
	public static final int NJ = 11;
	public static final int NQ = 12;
	public static final int NK = 13;
	public static final int NA = 14;
	public static final String[] numberNames = new String[] { "2", "3", "4", "5", "6", "7", "8", "9", "10", "Bube", "Dame", "König", "Ass" };

	private int color;
	private int number;
	
	public Card(int number, int color) {
		this.number = number;
		this.color = color;
	}
	
	public int getNumber()
	{
		return this.number;
	}
	
	public int getColor()
	{
		return this.color;
	}

	@Override
	public int compareNumber(Card card) {
		return this.getNumber() - card.getNumber();
	}

	@Override
	public boolean compareColor(Card card) {
		return this.getColor() == card.getColor();
	}

	@Override
	public String toString() {
		return Card.getNameForColor(this.getColor()) + " " + Card.getNameForNumber(this.getNumber());
	}
	
	public static String getNameForColor(int color)
	{
		return Card.colorNames[color - 1];
	}
	
	public static String getNameForNumber(int color)
	{
		return Card.numberNames[color - 2];
	}
	
	//Farbrating: CLUB, SPADE, HEART, DIAMOND
	public int rateCard(){
		int score = 0;
		
		score = score + (this.getNumber() - 2)*5 + this.getColor();
		
		return score;
	}
	
}
